package gov.child.entities.po;

import gov.child.entities.vo.annotation.Alias;
import gov.child.entities.vo.annotation.IgnoreField;

import javax.persistence.*;
import java.util.Date;
import java.util.Collection;

/**
 * @author fzh
 * @since 2017/9/16
 */
@Entity
@Table(name = "guide", schema = "gov_c")
public class EGuide {
    @Alias("guideId")
    private Integer id;
    private String title;
    private String guideCode;
    private Integer deptP;
    private Integer deptC;
    private String addr;
    private Byte obj;
    private Byte hierarchy;
    private Integer promiseTimeLimit;
    private Integer charge;
    private String powerFrom;
    private String serviceSubject;
    private String complaintTel;
    private String resultFile;
    private String consultationTel;
    private String categories;
    private String notice;
    private String dealBasis;
    private String applicationCondition;
    private String material;
    private String flowChart;
    private String callSituation;
    private String callBasis;
    private Byte online;
    private Date createTime;
    @IgnoreField
    private Collection<ECollection> collectionsById;
    @IgnoreField
    private Collection<ECollection> collectionsById_0;
    @IgnoreField
    private Collection<EComplaint> complaintsById;
    @IgnoreField
    private EDepartment deptByDeptP;
    @IgnoreField
    private EDepartment deptByDeptC;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "title", nullable = false, length = 32)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "guide_code", nullable = false, length = 26)
    public String getGuideCode() {
        return guideCode;
    }

    public void setGuideCode(String guideCode) {
        this.guideCode = guideCode;
    }

    @Basic
    @Column(name = "dept_p", nullable = false)
    public Integer getDeptP() {
        return deptP;
    }

    public void setDeptP(Integer deptP) {
        this.deptP = deptP;
    }

    @Basic
    @Column(name = "dept_c", nullable = false)
    public Integer getDeptC() {
        return deptC;
    }

    public void setDeptC(Integer deptC) {
        this.deptC = deptC;
    }

    @Basic
    @Column(name = "addr", nullable = true, length = 50)
    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    @Basic
    @Column(name = "obj", nullable = true)
    public Byte getObj() {
        return obj;
    }

    public void setObj(Byte obj) {
        this.obj = obj;
    }

    @Basic
    @Column(name = "hierarchy", nullable = true)
    public Byte getHierarchy() {
        return hierarchy;
    }

    public void setHierarchy(Byte hierarchy) {
        this.hierarchy = hierarchy;
    }

    @Basic
    @Column(name = "promise_time_limit", nullable = true)
    public Integer getPromiseTimeLimit() {
        return promiseTimeLimit;
    }

    public void setPromiseTimeLimit(Integer promiseTimeLimit) {
        this.promiseTimeLimit = promiseTimeLimit;
    }

    @Basic
    @Column(name = "charge", nullable = true)
    public Integer getCharge() {
        return charge;
    }

    public void setCharge(Integer charge) {
        this.charge = charge;
    }

    @Basic
    @Column(name = "power_from", nullable = true, length = 20)
    public String getPowerFrom() {
        return powerFrom;
    }

    public void setPowerFrom(String powerFrom) {
        this.powerFrom = powerFrom;
    }

    @Basic
    @Column(name = "service_subject", nullable = true, length = 10)
    public String getServiceSubject() {
        return serviceSubject;
    }

    public void setServiceSubject(String serviceSubject) {
        this.serviceSubject = serviceSubject;
    }

    @Basic
    @Column(name = "complaint_tel", nullable = true, length = 13)
    public String getComplaintTel() {
        return complaintTel;
    }

    public void setComplaintTel(String complaintTel) {
        this.complaintTel = complaintTel;
    }

    @Basic
    @Column(name = "result_file", nullable = true, length = 100)
    public String getResultFile() {
        return resultFile;
    }

    public void setResultFile(String resultFile) {
        this.resultFile = resultFile;
    }

    @Basic
    @Column(name = "consultation_tel", nullable = true, length = 13)
    public String getConsultationTel() {
        return consultationTel;
    }

    public void setConsultationTel(String consultationTel) {
        this.consultationTel = consultationTel;
    }

    @Basic
    @Column(name = "categories", nullable = true, length = 13)
    public String getCategories() {
        return categories;
    }

    public void setCategories(String categories) {
        this.categories = categories;
    }

    @Basic
    @Column(name = "notice", nullable = true, length = 1000)
    public String getNotice() {
        return notice;
    }

    public void setNotice(String notice) {
        this.notice = notice;
    }

    @Basic
    @Column(name = "deal_basis", nullable = true, length = 1000)
    public String getDealBasis() {
        return dealBasis;
    }

    public void setDealBasis(String dealBasis) {
        this.dealBasis = dealBasis;
    }

    @Basic
    @Column(name = "application_condition", nullable = true, length = 1000)
    public String getApplicationCondition() {
        return applicationCondition;
    }

    public void setApplicationCondition(String applicationCondition) {
        this.applicationCondition = applicationCondition;
    }

    @Basic
    @Column(name = "material", nullable = true, length = 1000)
    public String getMaterial() {
        return material;
    }

    public void setMaterial(String material) {
        this.material = material;
    }

    @Basic
    @Column(name = "flow_chart", nullable = true, length = 100)
    public String getFlowChart() {
        return flowChart;
    }

    public void setFlowChart(String flowChart) {
        this.flowChart = flowChart;
    }

    @Basic
    @Column(name = "call_situation", nullable = true, length = 1000)
    public String getCallSituation() {
        return callSituation;
    }

    public void setCallSituation(String callSituation) {
        this.callSituation = callSituation;
    }

    @Basic
    @Column(name = "call_basis", nullable = true, length = 1000)
    public String getCallBasis() {
        return callBasis;
    }

    public void setCallBasis(String callBasis) {
        this.callBasis = callBasis;
    }

    @Basic
    @Column(name = "online", nullable = false)
    public Byte getOnline() {
        return online;
    }

    public void setOnline(Byte online) {
        this.online = online;
    }
    @Basic
    @Column(name = "create_time", nullable = true)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        EGuide guide = (EGuide) o;

        if (id != null ? !id.equals(guide.id) : guide.id != null) return false;
        if (guideCode != null ? !guideCode.equals(guide.guideCode) : guide.guideCode != null) return false;
        if (deptP != null ? !deptP.equals(guide.deptP) : guide.deptP != null) return false;
        if (deptC != null ? !deptC.equals(guide.deptC) : guide.deptC != null) return false;
        if (addr != null ? !addr.equals(guide.addr) : guide.addr != null) return false;
        if (obj != null ? !obj.equals(guide.obj) : guide.obj != null) return false;
        if (hierarchy != null ? !hierarchy.equals(guide.hierarchy) : guide.hierarchy != null) return false;
        if (promiseTimeLimit != null ? !promiseTimeLimit.equals(guide.promiseTimeLimit) : guide.promiseTimeLimit != null)
            return false;
        if (charge != null ? !charge.equals(guide.charge) : guide.charge != null) return false;
        if (powerFrom != null ? !powerFrom.equals(guide.powerFrom) : guide.powerFrom != null) return false;
        if (serviceSubject != null ? !serviceSubject.equals(guide.serviceSubject) : guide.serviceSubject != null)
            return false;
        if (complaintTel != null ? !complaintTel.equals(guide.complaintTel) : guide.complaintTel != null) return false;
        if (resultFile != null ? !resultFile.equals(guide.resultFile) : guide.resultFile != null) return false;
        if (consultationTel != null ? !consultationTel.equals(guide.consultationTel) : guide.consultationTel != null)
            return false;
        if (categories != null ? !categories.equals(guide.categories) : guide.categories != null) return false;
        if (notice != null ? !notice.equals(guide.notice) : guide.notice != null) return false;
        if (dealBasis != null ? !dealBasis.equals(guide.dealBasis) : guide.dealBasis != null) return false;
        if (applicationCondition != null ? !applicationCondition.equals(guide.applicationCondition) : guide.applicationCondition != null)
            return false;
        if (material != null ? !material.equals(guide.material) : guide.material != null) return false;
        if (flowChart != null ? !flowChart.equals(guide.flowChart) : guide.flowChart != null) return false;
        if (callSituation != null ? !callSituation.equals(guide.callSituation) : guide.callSituation != null)
            return false;
        if (callBasis != null ? !callBasis.equals(guide.callBasis) : guide.callBasis != null) return false;
        if (online != null ? !online.equals(guide.online) : guide.online != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (guideCode != null ? guideCode.hashCode() : 0);
        result = 31 * result + (deptP != null ? deptP.hashCode() : 0);
        result = 31 * result + (deptC != null ? deptC.hashCode() : 0);
        result = 31 * result + (addr != null ? addr.hashCode() : 0);
        result = 31 * result + (obj != null ? obj.hashCode() : 0);
        result = 31 * result + (hierarchy != null ? hierarchy.hashCode() : 0);
        result = 31 * result + (promiseTimeLimit != null ? promiseTimeLimit.hashCode() : 0);
        result = 31 * result + (charge != null ? charge.hashCode() : 0);
        result = 31 * result + (powerFrom != null ? powerFrom.hashCode() : 0);
        result = 31 * result + (serviceSubject != null ? serviceSubject.hashCode() : 0);
        result = 31 * result + (complaintTel != null ? complaintTel.hashCode() : 0);
        result = 31 * result + (resultFile != null ? resultFile.hashCode() : 0);
        result = 31 * result + (consultationTel != null ? consultationTel.hashCode() : 0);
        result = 31 * result + (categories != null ? categories.hashCode() : 0);
        result = 31 * result + (notice != null ? notice.hashCode() : 0);
        result = 31 * result + (dealBasis != null ? dealBasis.hashCode() : 0);
        result = 31 * result + (applicationCondition != null ? applicationCondition.hashCode() : 0);
        result = 31 * result + (material != null ? material.hashCode() : 0);
        result = 31 * result + (flowChart != null ? flowChart.hashCode() : 0);
        result = 31 * result + (callSituation != null ? callSituation.hashCode() : 0);
        result = 31 * result + (callBasis != null ? callBasis.hashCode() : 0);
        result = 31 * result + (online != null ? online.hashCode() : 0);
        return result;
    }

    @OneToMany(mappedBy = "guideByGuideId")
    public Collection<ECollection> getCollectionsById() {
        return collectionsById;
    }

    public void setCollectionsById(Collection<ECollection> collectionsById) {
        this.collectionsById = collectionsById;
    }

    @OneToMany(mappedBy = "guideByGuideId_0")
    public Collection<ECollection> getCollectionsById_0() {
        return collectionsById_0;
    }

    public void setCollectionsById_0(Collection<ECollection> collectionsById_0) {
        this.collectionsById_0 = collectionsById_0;
    }

    @OneToMany(mappedBy = "guideByGuideId")
    public Collection<EComplaint> getComplaintsById() {
        return complaintsById;
    }

    public void setComplaintsById(Collection<EComplaint> complaintsById) {
        this.complaintsById = complaintsById;
    }

    @ManyToOne
    @JoinColumn(name = "dept_p", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    public EDepartment getDeptByDeptP() {
        return deptByDeptP;
    }

    public void setDeptByDeptP(EDepartment deptByDeptP) {
        this.deptByDeptP = deptByDeptP;
    }

    @ManyToOne
    @JoinColumn(name = "dept_c", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    public EDepartment getDeptByDeptC() {
        return deptByDeptC;
    }

    public void setDeptByDeptC(EDepartment deptByDeptC) {
        this.deptByDeptC = deptByDeptC;
    }
}
